//
//  WDLocationManager.h
//  wd-serviceapp
//
//  Created by Bin Tang on 2024/8/27.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
typedef void(^ResultLocationBlock)(CLLocation *location,NSString *addr);
typedef void(^ResultLocationCityBlock)(CLLocation *location,NSString *addr, NSString *city);
typedef void(^ResultCityName)(NSString *addr);

@interface WDLocationManager : NSObject

+ (instancetype)shareInstance;

@property (nonatomic, copy) ResultLocationBlock locationBlock;
@property (nonatomic, copy) ResultCityName cityBlock;
@property (nonatomic, copy) ResultLocationCityBlock locationCityBlock;

- (void)configLocationManager;
- (void)stopTrackLocation;
- (void)updateLocation;
/**
 最后一次获取到的位置信息
 */
@property (nonatomic, strong) CLLocation *lastLocation;
/**
 最后一次获取的地址
 */
@property (nonatomic, copy) NSString *province;
@property (nonatomic, copy) NSString *city;
@property (nonatomic, copy) NSString *district;
@property (nonatomic, copy) NSString *address;
@property (nonatomic, copy) NSString *adCode;

/// 更加抵制获取经纬度
/// - Parameter address: address description
- (void)geocodeSearchAds:(NSString *)address completion:(void(^)(CGFloat latitude, CGFloat longitude))completion;

/// 根据经纬度获取地址
/// - Parameters:
///   - lon: lon description
///   - lat: lat description
///   - completion: completion description
- (void)geocodeSearchLon:(double)lon lat:(double)lat completion:(void(^)(NSString *ads))completion;


/// 计算两点之间的具体
/// - Parameters:
///   - start: 开始坐标
///   - end: 结束坐标
///   - completion: completion description
- (void)getTwoPointDistance:(AMapGeoPoint *)start end:(AMapGeoPoint *)end completion:(void(^)(NSInteger distance))completion;

@end

NS_ASSUME_NONNULL_END
